/* 
 * File:   Nonterminal.h
 * Author: itu
 *
 * Created on November 26, 2011, 9:20 PM
 */
#include "Symbol.h"
#include "Terminal.h"
#include "Rule.h"
#include <vector>

#ifndef NONTERMINAL_H
#define	NONTERMINAL_H

class Nonterminal:public Symbol {
public:
    Nonterminal(string);
    void addRule(Rule);
    Rule getRule();
    bool hasRule();
    vector<Rule> getRules();
    void setRules(vector<Rule>);
    void printRules();
    void findFirst();
    bool checkSymbolInFirst(string);
    void setAsStart();
    bool checkIsStart();
    void addToFollow(Symbol*);
    void printFollowSet();
    vector<Symbol*> getFollowSet();
private:
    vector<Rule> rules;
    bool nullability; // A is nullable if it has a production A -> €
    bool startSymbol;
    vector<Symbol*> followSet;
    bool followSetAlreadyCalculated;
    //void checkNullability;
};

#endif	/* NONTERMINAL_H */

